<template>
  <view>
    <view v-if="form.type == 1" class="inner-view">
      <rich-text :nodes="form.content" class="inner-rich"></rich-text>
    </view>
    <view v-else>
      <span style="color: white;">Web-view 组件加载失败 :<br> Error 400</span>
      <web-view :src="form.url"></web-view>

    </view>
  </view>
</template>

<script>
import { get } from '../../static/js/request';

/**
 * json:
 * {
 *  title: '标题'
 *  intro: '简介'
 *  header: '头图'
 *  appType: 'Dll'
 * }
 */
export default {
  data() {
    return {
      id: null,
      form: {}
    }
  },
  onLoad(args) {
    this.id = args.id
    get("/article/query?id=" + this.id).then(res => {
      if (res.code != 200) {
        uni.navigateBack({ delta: 1 })
        uni.showToast({
          title: res.message,
          icon: 'none',
        })
      }
      this.form = res.result
    })
  }
}
</script>

<style scoped>
.inner-view {
  width: 100vw;
  height: 98vh;
  background: white;
  border-radius: 20rpx;
  padding: 1%;
  width: 98%;
  margin: 0 auto;
  overflow: scroll;
}

.inner-rich{
  
}
</style>